﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Eirene.Core.Model
{
    /// <summary>
    /// Encapsulates details about an item.
    /// </summary>
    public class Item
    {
        #region Constructors

        public Item()
        {
            Owners = new List<Owner>();

            Children = new ItemContainer();
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the name of the item.
        /// </summary>
        public string ItemName { get; set; }

        /// <summary>
        /// Gets or sets the colour of the item.
        /// </summary>
        public string Colour { get; set; }

        /// <summary>
        /// Gets or sets the item's price.
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// Gets or sets a list of owners for the item.
        /// </summary>
        public List<Owner> Owners { get; set; }

        /// <summary>
        /// Gets or sets a default owner for the item.
        /// </summary>
        public Owner DefaultOwner
        {
            get { return Owners.SingleOrDefault(i => i.IsDefault); }
        }

        /// <summary>
        /// Gets or sets the item's status.
        /// </summary>
        public Status Status { get; set; }

        public ItemContainer Children { get; private set; }

        #endregion
    }
}
